#include<stdio.h>
int main()
{
  int n;
  scanf("%d",&n);
  int x,total=0;
  int er=1;
  while(n>=1)
  {
    x=n%10;
    total=total+x*er;
    n=n/10;
    er=er*2;
  }
  printf("%d",total);
  return 0;
}